<?php
namespace Admin\Controller;
use Think\Controller;
class FeedbackController extends Controller {
    public function index($page=1){
        obtain();
        $Model = M('feedback');
        $count = $Model->where('dispose=0')->count();
        $pagenum = ($page < 2 || (($page-1)*10)>$count)?0:($page-1)*10;
        
        $Model = M('view_feedback_equipment');
        $result = $Model->where('dispose=0')->limit($pagenum,10)->select();
        $this->assign('zy', $name);
        $this->assign('list', $result);
        $page = getPageHtml($page,$count,__ROOT__."/Admin/Feedback/Index");
        $this->assign('page',$page);
        $this->display('index');
    }
    public function history($page=1){
        obtain();
        $Model = M('feedback');
        $count = $Model->where('dispose=1')->count();
        $pagenum = ($page < 2 || (($page-1)*10)>$count)?0:($page-1)*10;
        $Model = M('view_feedback_equipment');
        $result = $Model->where('dispose=1')->limit($pagenum,10)->select();
        $this->assign('zy', $name);
        $this->assign('list', $result);
        
        $page = getPageHtml($page,$count,__ROOT__."/Admin/Feedback/History");
        $this->assign('page',$page);
        $this->display('history');
    }
    public function dispose($id){
        obtain();
        $data = array('dispose'=>1);
        $map = array('fee_id'=>$id);
        if(M('feedback')->where($map)->save($data)){
            $this->success('已经处理');
        }else{
            $this->error('未处理');
        }
    }
}